﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Data;
using System.Globalization;
using System.Windows;

namespace QuickTweet.Common.Converters
{
    /// <summary>
    /// /// A type converter for visibility and boolean values. 
    /// </summary> 
    public class VisibilityOnEqualValueConverter : IMultiValueConverter
    {
        public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
        {
            if (values.Length < 2 || values[0].GetType() != typeof(string) || values[1].GetType() != typeof(string))
                return Visibility.Collapsed;

            string value1 = System.Convert.ToString(values[0]).ToLower();
            string value2 = System.Convert.ToString(values[1]).ToLower();

            return (value1 == value2) ? Visibility.Visible : Visibility.Collapsed;
        }

        public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
